<#include '/admin/header.html' >
<style>
.layui-input-block input {
	width: 40%;
}

.layui-form-pane .layui-form-label {
	width: 150px;
}

.input_text {
	height: 36px; ! important;
	border: 1px solid #ccc;
	!
	important;
}
</style>
<div class="admin-main">
	<!--表单区域  -->
	<form id="dataForm" class="layui-form layui-form-pane"
		style="padding: 10px 10px;">
		<#if isEdit > <input type="hidden" name="dataid" value="${dataid}" />
		<input type="hidden" id="dataAction"
			value="${ctx}/cms/admin/data/save-edit.do?ajax=yes&modelid=${modelid}" />
		<#else> <input type="hidden" id="dataAction"
			value="${ctx}/cms/admin/data/save-add.do?ajax=yes&modelid=${modelid!''}" />
		</#if>
		<div class="layui-form-item">
			<label class="layui-form-label _stration">所属分类：</label>
			<div class="layui-input-block">
				<input type="hidden" name="catid" value="${catid}"> <input
					class="layui-input" type="text" disabled="disabled"
					value="${cat.name}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">权重：</label>
			<div class="layui-input-block">
				<input type="text" name="sort"  maxlength="
					9"  lay-verify="required|number" autocomplete="off"
					class="layui-input"<#if isEdit
				>value="${(article.sort?c)!0}"</#if> />
				<div class="layui-form-mid layui-word-aux">	权重越高则越靠前显示</div>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">页面标题：</label>
			<div class="layui-input-block">
				<input type="text" name="page_title" maxlength="20"
					lay-verify="required" autocomplete="off" class="layui-input"<#if
				isEdit >value="${article.page_title!''}"</#if> />
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">页面关键字：</label>
			<div class="layui-input-block">
				<input type="text" name="page_keywords" maxlength="20"
					lay-verify="required" autocomplete="off" class="layui-input"<#if
				isEdit >value="${article.page_keywords!''}"</#if> />
			</div>
		</div>

		<div class="layui-form-item" style="width: 100%">
			<label class="layui-form-label">页面描述：</label>
			<div class="layui-input-block">
				<script id="editor1" name="page_description" type="text/plain"
					style="height: 200px; width: 90%; margin-left: 40px;">
						<#if isEdit  >${article.page_description!''}</#if>
				</script>
			</div>
		</div>

		<#if fieldList ??> 
			<#list fieldList as field >
			<div class="layui-form-item">
				<label class="layui-form-label">${field.china_name}：</label>
				<div class="layui-input-block">${field.inputHtml}</div>
			</div>
			</#list> 
		</#if>

		<div class="layui-form-item">
			<div class="layui-input-block" style="padding-bottom: 10px;">
				<button type="button" class="layui-btn save" lay-submit lay-filter="saveData">立即提交</button>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
	var ue = UE.getEditor('editor1', {
		zIndex : 0,
	});

	$(function() {
		//关键字和url添加layui样式
		$("._input input").addClass("layui-input");
	});

	layui.use([ 'form', 'layedit', 'laydate' ],function() {
		var form = layui.form(), layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;

		$(".layui-layer-btn1").click(function() {
			parent.layer.close(index);
		});

		//监听提交
		form.on('submit(saveData)',function(data) {

			var path = $("#dataAction").val();
			var options = {
				url : path,
				type : "post",
				dataType : "json",
				async : false,
				beforeSend : function() {
					$('.save').attr("disabled",true);
				},
				success : function(data) {
					if (data.result == 1) {
						parent.$.Loading.success(data.message); 
						closeCurrent(); //关闭页面
					} else {
						layer.msg(data.message,{icon : 5});
					}
				}
			};
			$("#dataForm").ajaxSubmit(options);
			return false;
		});
	});
</script>
<#include '/admin/footer.html' >
